Skip to content

[Common] Protect TOF PID tasks against empty collision tables#17048

Merged
dsekihat merged 2 commits into
AliceO2Group:masterfrom
zhangbiao-phy:fix-tof-empty-collision-tables
Jul 14, 2026
Merged

[Common] Protect TOF PID tasks against empty collision tables#17048
dsekihat merged 2 commits into
AliceO2Group:masterfrom
zhangbiao-phy:fix-tof-empty-collision-tables

Conversation

@zhangbiao-phy

@zhangbiao-phy zhangbiao-phy commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

This PR adds the same protection as #16935 for the TOF PID tasks.

It covers very rare AO2Ds from MC productions that do not contain any reconstructed collision. In these cases, all tracks have collisionId = 0, while the collision table is empty. The current code can therefore crash when trying to access the 0-th collision entry, which is not allocated.

The affected TOF PID paths now check that the collision table is non-empty before dereferencing the collision associated to a track.

Tagging @fgrosa for info!

@github-actions github-actions Bot changed the title Protect TOF PID tasks against empty collision tables [Common] Protect TOF PID tasks against empty collision tables Jul 13, 2026
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

O2 linter results: ❌ 26 errors, ⚠️ 61 warnings, 🔕 0 disabled

@zhangbiao-phy zhangbiao-phy marked this pull request as ready for review July 13, 2026 15:50
@alibuild

alibuild commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for c7ccd0f at 2026-07-13 18:35:

## sw/BUILD/O2Physics-latest/log
2026-07-13T18:29:48.030+0200 [26:140297775569472] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-13T18:29:48.030+0200 [26:140297775569472] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-13T18:30:35.389+0200 [26:140297775569472] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-13T18:29:47.728+0200 [24:139760025598528] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-13T18:29:47.728+0200 [24:139760025598528] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-13T18:30:46.826+0200 [24:139760025598528] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv6:%5B::1%5D:8980: Failed to connect to remote host: Connection refused]
2026-07-13T18:29:47.727+0200 [23:140242661583424] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-13T18:29:47.727+0200 [23:140242661583424] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-13T18:30:54.213+0200 [23:140242661583424] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv6:%5B::1%5D:8980: Failed to connect to remote host: Connection refused]
2026-07-13T18:29:47.923+0200 [25:139943211379264] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-13T18:29:47.923+0200 [25:139943211379264] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-13T18:30:54.922+0200 [25:139943211379264] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]


## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 30 errors and 0 warnings.'
Found 30 errors and 0 warnings.
++ [[ 30 -gt 0 ]]
++ cat /sw/BUILD/89305eee0af51ee38386189b612b5ca4e55bee2b/O2Physics-code-check/errors.txt
Common/TableProducer/PID/pidTOFBase.cxx:56:7: error: variable 'trackDistanceForGoodMatch' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:57:7: error: variable 'trackDistanceForGoodMatchLowMult' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:58:5: error: variable 'multiplicityThreshold' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:64:12: error: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:165:7: error: variable 'trackSampleMinMomentum' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:166:7: error: variable 'trackSampleMaxMomentum' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:187:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:236:26: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:240:27: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:244:25: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:248:29: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:268:32: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:281:9: error: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:290:11: error: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:310:7: error: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:375:84: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:437:84: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:457:7: error: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:458:7: error: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:472:9: error: Value stored to 'weight' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:61:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:89:51: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:126:28: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:126:56: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:129:28: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:129:57: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:157:9: error: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty,-warnings-as-errors]
[0 more errors; see full log]

Full log here.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for da4353f at 2026-07-13 19:49:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 49 errors and 0 warnings.'
Found 49 errors and 0 warnings.
++ [[ 49 -gt 0 ]]
++ cat /sw/BUILD/b6ce3bcb40e6802a56072a577a6e79215be02565/O2Physics-code-check/errors.txt
Common/TableProducer/PID/pidTOFBase.cxx:56:7: error: variable 'trackDistanceForGoodMatch' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:57:7: error: variable 'trackDistanceForGoodMatchLowMult' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:58:5: error: variable 'multiplicityThreshold' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:64:12: error: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:165:7: error: variable 'trackSampleMinMomentum' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:166:7: error: variable 'trackSampleMaxMomentum' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:187:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:236:26: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:240:27: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:244:25: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:248:29: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:268:32: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:281:9: error: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:290:11: error: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:310:7: error: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:375:84: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:437:84: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:457:7: error: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:458:7: error: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays,-warnings-as-errors]
Common/TableProducer/PID/pidTOFBase.cxx:472:9: error: Value stored to 'weight' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:61:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:89:51: error: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:126:28: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:126:56: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:129:28: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:129:57: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:157:9: error: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:166:11: error: implicit conversion 'int' -> 'bool' [readability-implicit-bool-conversion,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:185:7: error: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto,-warnings-as-errors]
Common/TableProducer/PID/pidTOFFull.cxx:199:9: error: the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:79:12: error: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:85:8: error: constructor does not initialize these fields: ccdb, tofResponse [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:139:33: error: redundant boolean literal in conditional assignment [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:213:7: error: variable 'trackSampleMinMomentum' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:214:7: error: variable 'trackSampleMaxMomentum' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:241:8: error: constructor does not initialize these fields: ccdb, tofResponse [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:313:26: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:317:26: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:325:32: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:404:86: error: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:423:9: error: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays,-warnings-as-errors]
Common/TableProducer/PID/pidTOFMerge.cxx:424:9: error: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays,-warnings-as-errors]
[0 more errors; see full log]

Full log here.

@dsekihat dsekihat merged commit 2dff492 into AliceO2Group:master Jul 14, 2026
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants